using System;
using System.Diagnostics;

using org.fourzoas.noise.module;
using org.fourzoas.noise.model;

namespace org.fourzoas.noise.model {
  /// <summary>The abstract base class for all models.</summary>
  /// <seealso cref="Cylinder"/>
  /// <seealso cref="Line"/>
  /// <seealso cref="Plane"/>
  /// <seealso cref="Sphere"/>
  public abstract class Model {
    /// <summary>
    /// Default constructor.
    /// </summary>
    public Model() {
      m_Module = null;
    }
    /// <summary>
    /// Constructor allowing module to be specified.
    /// </summary>
    /// <param name="m">The noise module that is used to generate the output values.</param>
    public Model(Module m) {
      m_Module = m;
    }
    /// <summary>
    /// The noise module used to generate the output values.
    /// </summary>
    protected Module m_Module;
    /// <summary>
    /// Gets or sets the noise module that is used to generate the output values.
    /// </summary>
    public Module Module {
      get {
        Debug.Assert(m_Module != null);
        return m_Module;
      }
      set {
        m_Module = value;
      }
    }
    /// <summary>
    /// Returns the output value for the given model.
    /// </summary>
    /// <param name="coords">The coordinates of the point for which a value is desired.</param>
    /// <returns>The resulting value from the given point.</returns>
    public abstract double GetValue(params double[] coords);
  }
}
